package org.jfk.tbox.net.app;

import org.jfk.core.utils.ByteUtils;

public class TBOX_SMSCtlCommand {
	TBOX_SMSCtlCommandReq smsCtlCommandReq = null;
	int appId = 0x0102;
	public TBOX_SMSCtlCommandReq getTBOX_SMSCtlCommandReq(){
		if (smsCtlCommandReq != null){
			return smsCtlCommandReq;
		}else{
			smsCtlCommandReq = new TBOX_SMSCtlCommandReq();
			return smsCtlCommandReq;
		}
	}

	public class TBOX_SMSCtlCommandReq {
		int msgId = 1;
		public int smscommand = 0;
		public byte[] smsconfig = new byte[64];
	}
	
	public TBOX_SMSCtlCommandReq loadSMSCtlCommandReqData(int smscommand,String... param){
		if (smsCtlCommandReq == null){
			smsCtlCommandReq = new TBOX_SMSCtlCommandReq();
		}
		smsCtlCommandReq.smscommand = smscommand;
		if (0x21 == smscommand){
			
			//上报时间间隔，计时单位秒，一个字节
			smsCtlCommandReq.smsconfig[61] = (byte)Integer.valueOf(param[0]).intValue();
			
			//发送次数0..65535
			int count = Integer.valueOf(param[1]).intValue();
			byte[] b = ByteUtils.intToWord(count);
			smsCtlCommandReq.smsconfig[62] = b[0];
			smsCtlCommandReq.smsconfig[63] = b[1];
			
		}
		if (0x22 == smscommand){
			smsCtlCommandReq.smsconfig[63] = param[0].getBytes()[0];
		}
		return smsCtlCommandReq;
	}
	
}

